package com.eight.statistics.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.eight.statistics.dao.CourseDao;
import com.eight.statistics.pojo.Course;
import com.eight.statistics.vo.TimeVo;
import com.eight.statistics.service.CourseService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @program: qy8-education
 * @description:
 * @author: 郑友民（1460115388@qq.com）
 * @create: 2023-05-27 20:34
 **/
@Service
public class CourseServiceImpl implements CourseService {
    @Resource
    private CourseDao courseDao;

    @Override
    public List<Course> queryAllCourseRanking(TimeVo timeVo) {
        QueryWrapper<Course> wrapper = new QueryWrapper<>();
        if (timeVo.getGmtCreate() != null) {
            wrapper.ge("gmt_modified", timeVo.getGmtCreate());
        }
        if (timeVo.getGmtModified() != null) {
            wrapper.le("gmt_modified", timeVo.getGmtModified());
        }
        wrapper.eq("is_deleted",0);
        List<Course> courses = courseDao.selectList(wrapper);
        return courses;
    }
}

